Primitive Processing in a Graphics Processing System

ABSTRACT

A graphics processing system has a rendering space which is divided into tiles. Primitives within the tiles are processed to perform hidden surface removal and to apply texturing to the primitives. The graphics processing system includes a plurality of depth buffers, thereby allowing a processing module to process primitives of one tile by accessing one of the depth buffers while primitive identifiers of another, partially processed tile are stored in another one of the depth buffers. This allows the graphics processing system to have “multiple tiles in flight”, which can increase the efficiency of the graphics processing system.

BACKGROUND

In a 3D graphics processing system, objects of a scene are representedwith groups of primitives, which are typically projected, scanconverted, textured, and shaded during rendering of the scene. Aprimitive has a simple geometric shape, often a triangle, defined by thepositions of one or more vertices (e.g. three vertices in the case thatthe primitive is a triangle) to which a texture can be applied. Therendering of a 3D scene processes the primitives to form an imagecomprising an array of image pixels. One step in the rendering processis to determine, for each of a plurality of sample positions of theimage, which of the primitives is/are visible. This process is calledhidden surface removal (HSR). Primitives, or parts of primitives, whichare hidden by other primitives do not need to be considered further inthe render. In order to perform HSR, the depths (i.e. the distances fromthe viewpoint) of primitives in the scene for each sample position areconsidered in order to determine which primitives are visible at eachpixel position. Primitives may be opaque or translucent. A renderingtechnique in which textures are used to create holes in otherwise opaqueprimitives is known as “punch through”. For opaque primitives, the finalrendered pixel value at a pixel position (which may correspond to one ormore of the sample positions) will usually be given by the texturedprimitive which has the smallest depth value at that pixel position. Fortranslucent primitives the final rendered pixel value at a pixelposition may be given by a blend of more than one of the texturedprimitives which have the smallest depth values at that pixel position.When a scene contains primitives whose textures include punch through,the final rendered pixel value at a pixel position may be determined byprimitives other than the primitive with the smallest depth value atthat pixel position.

FIG. 1 shows a graphics processing system 100 comprising a processingmodule 102 which may be referred to as an Image Synthesis Processor(ISP), a depth buffer 104 which may be referred to as a Z-buffer, a tagsorter module 106, a texturing and shading engine 108 which may bereferred to as a Unified Shading Cluster (USC), and a pixel buffer 110.In operation, primitives (e.g. vertex coordinates and primitiveidentifiers) are received at the ISP 102, and the ISP performs HSR onthe primitives to determine which primitives are visible at each of aplurality of sample positions of the image to be rendered. In order toimplement the HSR for a typical render, the ISP is programmed to storein depth buffer 104, for each sample position, a depth valuerepresenting the depth of the closest primitive which has been processedso far by the ISP 102, such that the ISP 102 can compare the depth of aprimitive currently being processed with the depth values stored in thedepth buffer 104 to determine whether the current primitive is visible.The results of the HSR performed by the ISP 102 are used to update thedepth values stored in the depth buffer 104 accordingly. It is notedthat in some systems, the depth buffer 104 and tag sorter module 106 maybe described as components of the ISP 102.

The tag sorter module 106 comprises a tag buffer which is configured tostore, for each sample position, a primitive identifier (ID) of avisible primitive at that sample position as determined by the HSRperformed by the ISP 102. The tag sorter module 106 also comprises acontroller to control the updating and flushing of the tag buffer.Primitive identifiers are flushed to the USC 108. In response toreceiving the flushed primitive identifiers, the USC 108 will retrievethe identified primitives and will retrieve texture data in order toapply texturing and shading to the primitives identified by the flushedprimitive IDs. The controller in the tag sorter module 106 controls whenprimitive identifiers are flushed to the USC 108. For example, primitiveidentifiers may be flushed to the USC 108 when the primitives for theimage have all been processed by the ISP 102. Primitive identifiers mayalso be flushed to the USC 108 when primitive identifiers of translucentprimitives, or primitives with texturing that includes punch through,are to be stored in the tag buffer. This is so that these primitives canbe properly blended.

SUMMARY

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used to limit the scope of the claimed subject matter.

There is provided a graphics processing system having a rendering spacesub-divided into tiles, the graphics processing system comprising: aplurality of depth buffers, each of the depth buffers being configuredto be dynamically associated with one tile at a time and configured tostore a depth value for each sample position within the tile; and aprocessing module configured to receive primitives and tiling data,wherein for each primitive the tiling data indicates one or more tilesin which that primitive will be processed, and wherein the processingmodule is configured to perform hidden surface removal for a primitiveof a tile by comparing depth values for that primitive with depth valuesstored in the depth buffer associated with the tile while another one ofthe depth buffers stores depth values for a different partiallyprocessed tile.

There is also provided a method of processing primitives in a graphicsprocessing system having a rendering space sub-divided into tiles, themethod comprising: storing depth values in a plurality of depth buffers,each of the depth buffers being dynamically associated with one tile ata time and being configured to store a depth value for each sampleposition within the tile; receiving primitives and tiling data at aprocessing module, wherein for each primitive the tiling data indicatesone or more tiles in which that primitive will be processed; andperforming hidden surface removal at the processing module for aprimitive of a tile by comparing depth values for that primitive withdepth values stored in the depth buffer associated with the tile whileanother one of the depth buffers stores depth values for a differentpartially processed tile.

There is also provided computer readable code adapted to perform thesteps of any of the methods of the examples described herein when thecode is run on a computer. Furthermore, there may be provided computerreadable code for generating any of the graphics processing systems ofthe examples described herein. The computer readable code may be encodedon a computer readable storage medium.

The above features may be combined as appropriate, as would be apparentto a skilled person, and may be combined with any of the aspects of theexamples described herein.

BRIEF DESCRIPTION OF THE DRAWINGS

Examples will now be described in detail with reference to theaccompanying drawings in which:

FIG. 1 is a schematic diagram of a graphics processing system;

FIG. 2 represents four tiles of a rendering space;

FIG. 3 is a schematic diagram of a graphics processing systemimplementing a plurality of depth buffers;

FIG. 4 is a flow chart for a method of processing primitives in thegraphics processing system shown in FIG. 3;

FIG. 5 a is a diagram showing primitives which are visible in a tile ina first example;

FIG. 5 b shows corresponding columns of a plurality of tag buffersstoring primitive identifiers for the primitives shown in FIG. 5 a;

FIG. 5 c is a diagram showing primitives which are visible in a tile ina second example;

FIG. 5 d shows corresponding columns of a plurality of tag buffersstoring primitive identifiers for the primitives shown in FIG. 5 c;

FIG. 6 is a schematic diagram of a graphics processing systemimplementing a plurality of tag buffers;

FIG. 7 is a flow chart for a method of processing primitives in thegraphics processing system shown in FIG. 6;

FIG. 8 is a schematic diagram of a graphics processing systemimplementing a plurality of depth buffers and a plurality of tagbuffers; and

FIGS. 9 a and 9 b show a flow chart for a method of controlling theselection of tag buffers and the flushing of tag buffers.

The skilled person will appreciate that the illustrated elementboundaries (e.g., boxes, groups of boxes, or other shapes) in thedrawings represent one example of the boundaries. It may be that in someexamples, one element may be designed as multiple elements or thatmultiple elements may be designed as one element. Common referencenumerals are used throughout the figures, where appropriate, to indicatesimilar features.

DETAILED DESCRIPTION

The graphics processing system 100 described in the background sectionabove is efficient because hidden surface removal is performed in theISP 102, and only visible surfaces are sent for texturing and shading atthe USC 108. Systems that perform texturing and shading before hiddensurface removal may be less efficient because the work done in texturingand shading an object is wasted if that object is later hidden by otherobjects in the scene.

The system of FIG. 1 is most efficient when processing only opaqueprimitives, when hidden surface removal may be completed for a wholescene, or part of a scene, before texturing and shading begins. Theprimitive IDs of the opaque objects are collected by the tag sorter 106,such that when every opaque primitive has been processed by the ISP 102,the tag buffer stores an identifier for the primitive visible at eachsample position. The tag buffer may then be flushed, sending theprimitive IDs to the USC 108 such that the corresponding identifiedprimitives may be textured and shaded. The tag sorter 106 is so-calledbecause primitive IDs may be grouped, or sorted, as they are flushedfrom the buffer, such that, wherever possible, the USC 108 is able toprocess IDs from a single primitive, or from primitives with similartexturing and shading requirements, as a group. Sorting the primitiveIDs may therefore lead to improved cache performance in the USC 108.When a scene consists only of opaque primitives, the tag buffer needonly be flushed once.

The system of FIG. 1 encounters problems in some situations, such aswhen a scene contains translucent or punch through primitives.

Translucency means that light is able to pass through objects. Whenrendering translucent objects it is no longer sufficient to render onlythe primitives with the smallest depth value, since it may be necessaryto see through those primitives to the primitives behind. The colour ofa pixel in the rendered image may be formed by blending the colour of atranslucent primitive with the colour of one or more other primitives.Typically, the rendered image is built up by blending layers oftranslucent objects, starting with the primitives with the greatestdepth value, and ending with the primitives with the smallest depthvalue. Not all rendering systems are capable of sorting translucentobjects, so it is often left to the software application (e.g. a game)to present the primitives pre-sorted into a back to front order. In oneexample of translucency processing, translucent primitives are processedin the ISP 102 (for example to determine if they are hidden behindexisting opaque objects at any sample positions), and the tag buffer isflushed after each translucent primitive, such that the primitive can betextured and shaded, and blended with previously textured and shadedprimitives in pixel buffer 110. If the application sends further opaqueprimitives after the translucent primitives, the results of the blendingmay be hidden.

Punch through refers to a rendering technique where a texture may beused to add holes to otherwise opaque primitives. Holes in a primitiveshould not result in the ISP 102 updating depth buffer 104, but thesystem of FIG. 1 only evaluates the textures, and therefore determineswhere the holes are, in the USC 108. The system of FIG. 1 must thereforetake some additional steps to render punch through objects. In anexample of punch through processing, a punch through primitive arrivingat ISP 102 is sampled, and may be tested against depth buffer 104 todetermine any parts that are hidden behind existing opaque objects. Anyparts of the punch through object that are not hidden are sent to thetag sorter 106, but depth buffer 104 is not updated. The tag buffer isflushed immediately, which may involve flushing any existing contents ofthe tag buffer, then sending the punch through primitive to the USC 108.The USC 108 performs at least the texturing and shading operationsrequired to determine whether any parts of the primitive have holes, andreturns the opaque parts to the ISP 102 through the path labelled “PTFeedback” that is shown with a dotted line in FIG. 1. The ISP 102performs another depth test, since the state of depth buffer 104 mayhave changed in the time taken to texture and shade the punch throughprimitive, and any parts of the primitive that remain visible are storedas primitive IDs in the tag buffer. When the primitive ID is eventuallyflushed to the USC 108 for the second time, the remainder of thetexturing and shading is performed, and image pixels are stored in pixelbuffer 110.

Flushing the primitive identifiers for translucent or punch throughprimitives as described above may be inefficient because some of theflushed primitive identifiers may relate to primitives which aresubsequently hidden by other primitives that the ISP 102 is yet toprocess. Furthermore, flushing primitive identifiers whenevertranslucent primitives or primitives with punch through textures areprocessed may result in many flushes being performed (e.g. with eachflush including a small number of primitive identifiers). It is oftenless efficient to perform lots of small flushes compared to performingfewer larger flushes of primitive identifiers to the USC 108.

Furthermore, in a graphics processing system in which a rendering spaceis subdivided into a plurality of regions, or “tiles”, which areprocessed independently, the ISP 102 processes primitives for a tile ata time in the graphics processing system 100 shown in FIG. 1. When theISP 102 has processed the primitives for one tile (e.g. by performingHSR for the primitives of the tile) it can then start to process theprimitives of a next tile. The depth buffer 104 stores depth values foreach sample position within a tile that the ISP 102 is currentlyprocessing; and the tag buffer in the tag sorter module 106 storesprimitive identifiers for each sample position within the tile that theISP 102 is currently processing. The graphics processing system 100shown in FIG. 1 is therefore constrained to processing primitives fortiles, a tile at a time, such that all of the primitives of a tile areprocessed before primitives of the next tile are processed. That is, thetiles are processed in a serial manner, i.e. in sequence.

Embodiments will now be described by way of example only.

As indicated above, a graphics processing system may have a renderingspace which is subdivided into a plurality of tiles, which are processedindependently. FIG. 2 shows four tiles 202 ₁ to 202 ₄ of a renderingspace 200 which is used for rendering an image. The rendering space 200may include more than four tiles (or fewer than four tiles), but forclarity only four tiles are shown in FIG. 2. As indicated in FIG. 2,each of the tiles in this example has a size of 32×32 sample positions.A sample position represents a position of the rendered image, and mayor may not correspond to the actual pixel positions of the final image,whereby the pixel positions are the positions for which pixel values aredetermined and stored in a pixel buffer for representing an image. Theprimitives are sampled at each sample position to create “fragments”which are then processed, for example by hidden surface removal,texturing, and shading, in the rest of the rendering system. In someexamples there may be more sample positions than pixel positions whichallows the processing of the primitives to be performed at a finergranularity than the granularity of the pixels of the final image. Thiscan be useful for using anti-aliasing techniques to reduce theappearance of jagged edges in the rendered image. As shown in FIG. 2,each tile is further subdivided into microtiles 204 which in thisexample have a size of 4×4 sample positions. The use of the microtilesis explained further in the examples described below. It is noted thatin other examples the tiles and microtiles may have different sizesand/or shapes to those in the example shown in FIG. 2.

FIG. 3 shows a graphics processing system 300 which is configured toallow the processing of primitives to switch between primitives ofdifferent tiles before all of the primitives of a particular tile havefinished being processed. In this sense the graphics processing system300 can have “multiple tiles in flight”, i.e. multiple tiles for whichthe primitives are partially processed at a given time. In order toachieve this the graphics processing system 300 comprises a processingmodule 302, a depth buffer block 304, a tag sorter module 306, atexturing unit 308, a pixel buffer 310, and a control module 316. Thisexample also includes a block of queues 312. In the example shown inFIG. 3, the block of queues 312 comprises four queues 314 ₁ to 314 ₄;the depth buffer block 304 comprises four depth buffers 318 ₁ to 318 ₄;the tag sorter module 306 comprises four tag buffers 320 ₁ to 320 ₄ anda tag control module 322; and the texturing unit 308 comprises fourtexturing engines 324 ₁ to 324 ₄. The elements of the graphicsprocessing system 300 shown in FIG. 3 may be implemented in hardware,software or a combination thereof.

The operation of the graphics processing system 300 is described withreference to the flow chart shown in FIG. 4. Primitives of differenttiles are received at the block of queues 312 of the graphics processingsystem 300. The primitives may relate to objects of a scene to berendered, and may for example be sent to the graphics processing system300 from an application (e.g. a game) running on the same device (e.g. amobile user device) as the graphics processing system 300. Theprimitives are associated with tiling data which indicates one or moretiles 202 in which the primitives will be processed. The tiling data mayhave been determined in a previous operation of determining which tilesthe primitives are present in, which is not described in detail herein.Each of the primitives is described by primitive data which includes anindication of the positions of the vertices of the primitive, and mayinclude other information such as an indication of a texture to beapplied to the primitive. Each of the queues 314 ₁ to 314 ₄ isconfigured to store the primitives for a respective tile at a time. Inthe examples described herein, the tiling data indicates which tile eachprimitive is for. In the examples described above, since a queue isassociated with a tile at a time, the tiling data associated with theprimitives does not need to be, and is not, stored in the queues toindicate which tile each primitive is for. However, in some otherexamples, the tiling data may be stored in the queues with theprimitives. The queues 314 may for example be implemented as First InFirst Out (FIFO) buffers. The graphics processing system 300 shown inFIG. 3 can have up to four tiles in flight at a given time. In someexamples there may be a different number of queues in the block 312, andin some examples there might not be any queues and the primitives andtiling data may be received directly at the processing module 302without first storing the primitives and tiling data in any queues asshown in FIG. 3.

In step S402 the processing module 302 receives primitives and theassociated tiling data. The tiling data identifies the tile or tiles inwhich the primitive will be processed, and should identify at least oneof the tiles to which the resources (e.g. the depth and tag buffers) ofthe processing module 302 are currently assigned. In the example shownin FIG. 3 the primitives and tiling data are received at the processingmodule 302 from one of the queues 314 ₁ to 314 ₄. Since each of thequeues 314 ₁ to 314 ₄ is configured to store the primitives for arespective tile at a time, the tiling data may simply comprise theidentity of the queue from which the primitive is received.

In step S404 the processing module 302 performs hidden surface removal(HSR) for a primitive of a tile by comparing depth values for thatprimitive with depth values stored in the depth buffer associated withthe tile. Each of the depth buffers 318 ₁ to 318 ₄ is configured to beassociated with one tile at a time and configured to store a depth valuefor each sample position within the respective associated tile. Forexample, the four depth buffers 318 ₁ to 318 ₄ may be associated withfour tiles (tile A to tile D) respectively. The four tiles with whichthe depth buffers are associated may be selected from any position onthe rendering surface. There is no requirement that the tiles beadjacent to each other. In some examples, tiles may be selected frompositions in more than one rendering surface.

The HSR performed by the processing module 302 for a primitive comprisesdetermining which sample positions lie within the primitives (based onthe vertex positions of the primitives), and performing depth tests atthese sample positions based on the depth values stored in the relevantdepth buffer 318.

As part of step S404 the processing module 302 may update one or more ofthe depth values stored in the depth buffer 318 associated with the tilethat is currently being processed.

The processing module 302 has a processing unit which operates on oneprimitive at a time. However, since the graphics processing system 300comprises a plurality of depth buffers 318 ₁ to 318 ₄, it is able toswitch between processing primitives from different tiles beforefinishing the processing of all of the primitives within a tile. Thatis, the processing module 302 can perform HSR for a primitive of a tilewhile another one of the depth buffers 318 stores depth values for apartially processed tile. The partially processed tile in this case is adifferent tile to the tile for which a primitive is currently beingprocessed by the processing module 302. This allows greater flexibilityin the order in which the primitives are processed by the processingmodule 302, which can lead to more efficient processing of theprimitives by the graphics processing system 300 compared to theprocessing performed by the graphics processing system 100 in which allof the primitives of one tile are processed by the processing module 102before any of the primitives of the next tile are processed by theprocessing module 102. For example, if the processing of a tile stallsfor some reason that is specific to the tile being processed, then theprocessing module 302 of the graphics processing system 300 can continueto process primitives from other tiles, whereas the processing module102 of the graphics processing system 100 may be stalled until theprocessing can resume for the stalled tile. Furthermore, as describedbelow, multiple texturing engines 324 can be implemented, to increasethe texturing and shading capability of the system. In previous systemsa processing unit with a single depth buffer has been coupled tomultiple texturing engines. It was therefore necessary to devise asystem to supply fragments to each texturing engine, in such a way thatthe loading of the texturing engines is kept reasonably well balanced,and so that the efficiency of caches, etc., is maintained. In practicethis is difficult to achieve.

In the present system, where there are multiple tiles in flight, it canbe efficient to use the same texturing engine 324 for applying texturingto all of the visible primitives within a particular tile. That is, eachtexturing engine 324 can be associated with a respective tile.

This association can be beneficial because each primitive in a tilecauses texturing data for that primitive to be loaded into the localcaches of the texturing engine 324. By processing a primitive'sfragments in a single texturing engine 324, the primitive's texturingdata is loaded only into the caches of that texturing engine. Incontrast, if the primitive's fragments were distributed to severaltexturing engines, the same texturing data would be duplicated inseveral caches. By avoiding duplication of data, the efficiency of thecaches is improved. The arrangement is also beneficial in that theloading of the texturing engines 324 can be more easily balanced, forexample by associating each texturing engine 324 with a different one ofthe multiple tiles in flight, rather than by attempting to evenlydistribute the fragments from one tile to several texturing engines.Load balancing is described in more detail below.

In step S406 primitive identifiers for the fragments which survive thehidden surface removal of step S404 are stored in the tag buffers 320,such that, after each primitive has been processed, the tag bufferscontain the identity of the primitive that is visible at each samplelocation. In the example shown in FIG. 3, there are four tag buffers(320 ₁ to 320 ₄) in the tag sorter module 306, which is the same as thenumber of depth buffers 318, such that each of the tag buffers 320 ₁ to320 ₄ is dynamically associated with a respective particular tile. Thatis, each of the tag buffers 320 stores the primitive identifiersidentifying the primitives determined by the HSR to be visible at eachsample position within a respective tile. In general, for each of thetiles that may be “in flight” there is an associated set of at least onetag buffer 320 configured to store the primitive identifiers for thevisible primitives of that tile. In the example shown in FIG. 3 all ofthe “sets of tag buffers” which are associated with particular tilesinclude just one tag buffer 320, but as is described in more detailbelow with reference to FIGS. 6 and 8 these sets may include more thanone tag buffer.

The tag control module 322 of the tag sorter module 306 controls theselection of one of the tag buffers 320 for storage of each of theprimitive identifiers received at the tag sorter module 306 as theoutput of the HSR performed by the processing module 302. The tagcontrol module 322 also controls the flushing of primitive identifiersfrom the tag buffers 320 ₁ to 320 ₄. The flushed primitive identifiersare passed to the texturing unit 308. The operation of the tag sortermodule 306 is described below in more detail in relation to FIGS. 5 a to9 b.

In step S408 one of the texturing engines 324 ₁ to 324 ₄ appliestexturing and shading to the primitives identified by the flushedprimitive identifiers. A texturing engine 324 retrieves texture data andthe identified primitives (e.g. from a memory) and applies the texturedata to the primitives identified by the flushed primitive identifiers.In the example shown in FIG. 3 there are four texturing engines 324 ₁ to324 ₄, i.e. there are the same number of texturing engines 324 as thereare depth buffers 318. In this case each of the texturing engines isassociated with a respective tile such that all of the texturing that isapplied to the primitives of a particular tile is performed by the sametexturing engine 308. That is, the primitive identifiers in the tagbuffer(s) 320 associated with a particular tile are all sent to the sameones of the texturing engines 324, such that all of the texturing thatis applied to the visible primitives of the particular tile is appliedby the same texturing engine 324. As described above, this may improvethe efficiency of texturing the primitives in the case that there aremultiple tiles in flight. Methods for applying texturing to primitivesare known in the art, and as such the texturing process is not describedin great detail herein.

The result of applying the texturing to the primitives at the texturingunit 308 is a set of pixel values for the image. The texturing unit 308may comprise some logic for converting sample values to pixel valueswhere the samples do not exactly correspond to the pixels (e.g. wherethere are more samples than pixels). The pixel values are output fromthe texturing unit 308 and stored in the pixel buffer 310. The pixelbuffer 310 stores the pixel values of the image which can then be usedin any suitable manner, e.g. output to a display or stored in a memoryor transmitted to another device, etc.

The control module 316 controls which primitives are processed by theprocessing module 302 to thereby control the switching of the processingmodule 302 between processing primitives for different tiles. In orderto control the switching of the processing module 302, the controlmodule 316 may send a control signal to the block of queues 312, therebyselecting one of the queues 314. Alternatively, the control module 316may send a control signal to the processing module 302 indicating whichof the queues 314 the processing module 302 should read from. Thecontrol module 316 may manage the flow control in different ways and thetwo methods suggested above are given by way of example only. Aprimitive from the selected queue 314 is sent to the processing module302. The primitive's associated tiling data is also sent to theprocessing module 302, such that the primitive can be processed asdescribed above. As shown in FIG. 3, the control module 316 may receivestate information which describes the state of the graphics processingsystem 300. The selection of the one of the queues 314 by the controlmodule 316 may be based on the state information. The state informationmay be any suitable information relating to the state of the graphicsprocessing system 300 which may be useful for the control module 316 indetermining whether to switch the processing of the processing module302 in order to process primitives of a different tile.

For example, the control module 316 may receive state information fromthe texturing unit 308 indicating that one of the texturing engines 324is idle or is about to become idle. In this case, the control module 316may prioritise the processing of primitives for the tile currentlyassociated with the indicated texturing engine 324. This is useful inorder to balance the processing load across the different texturingengines 324, e.g. thereby avoiding, if appropriate, a situation in whichone of the texturing engines 324 is not being utilised to the greatestextent possible. In one example the state information received bycontrol module 316 comprises information about the state of buffers(e.g. FIFOs) at the interfaces between tag buffers 320 and texturingengines 324. A tag buffer 320 may flush many primitive identifiers atone time, and a texturing engine 324 may process them one at a time, orin small groups. The texturing engines may therefore buffer a number ofprimitive identifiers until they can be scheduled for execution by thetexturing engine. When the number of buffered primitive identifiersfalls to zero the texturing engine has no more work to do, and becomesidle. Control module 316 may prioritise the processing of primitives inan attempt to ensure that the buffers never, or rarely, become empty.“Prioritising” the processing of primitives for a tile may meanincreasing the frequency with which the primitives for that tile areselected to be processed by the processing module 302, or, as describedbelow, preferentially selecting a tag buffer associated with that tile,when it is necessary to perform a flush.

As another example, the control module 316 may receive stateinformation, e.g. from the tiling process, indicating that there is alarge quantity of data (e.g. many layers of primitives) to process in atile. In this case, the control module 316 may be configured toprioritise the processing of primitives for the tile by ensuring that aqueue 314 is assigned to that tile at an early opportunity. By doingthis, the system ensures that other tiles are able to be processedsimultaneously, thereby increasing the utilisation of the texturingengines.

As another example, the control module 316 may receive stateinformation, e.g. from the texturing unit 308 or the tag sorter module306, indicating that the processing of a tile has stalled, e.g. becauseit is waiting for a response to a memory access request to an off-chipmemory. In this case, the control module 316 is configured todeprioritise the processing of primitives for the stalled tile.“Deprioritising” the processing of primitives for a tile may meanreducing the frequency with which the primitives for that tile areselected to be processed by the processing module 302. The stateinformation may include more than one of the indications described aboveand in this case the effects of the differentprioritisations/deprioritisations can be combined in order to determinewhich of the tiles should be selected.

Other example graphics processing systems might not include a controlmodule 316, and the selection of which of the primitives should beprocessed by the processing module 302 may be determined in a differentmanner. For example, one of the queues 314 could be selectedperiodically at random to provide a primitive to the processing module302 when the processing module 302 is ready to receive a new primitive.Alternatively, the queues 314 could each be selected in turn in somepattern, e.g. according to a round robin scheme.

It can therefore be appreciated that the graphics processing system 300allows multiple tiles to be “in flight” wherein the processing module302 can perform HSR for primitives for one tile using one of the depthbuffers 318 while depth values for a different, partially processed tileare stored in a different one of the depth buffers 318.

There can be a situation in which many primitives are present at aparticular sample position within a tile, such that the primitives areoverlapping. An example of such a situation is shown in FIG. 5 a which,for clarity, shows a small tile 500, which is divided into an 8×8 grid.In this example, each grid square corresponds to a screen pixel and hasa sample position, typically at its centre. As described above,different tile configurations and sampling patterns are possible. FIG. 5a shows that there is a primitive 502 which covers the whole of the tile500, and may for example represent a background in the image. In frontof the primitive 502 (i.e. closer to the viewpoint, and thereforerepresented, in this example, by smaller “depth” values) there are twofurther primitives 504 and 506 which do not overlap with each other. Itcan be seen in FIG. 5 a that the primitive 504 does not extend outsideof the tile 500, whereas the primitive 506 extends outside the tile 500,e.g. into another tile (not shown in FIG. 5 a) which is positioned belowthe tile 500. In front of the primitives 502, 504 and 506 is anotherprimitive 508. Further, in front of the primitive 508 is a furtherprimitive 510. If the primitives are completely opaque then the finalsample values will be determined by the closest primitive at each of thesample positions. If some of the primitives are not fully opaque (e.g.they have some translucency or have textures which include punchthrough) then the final sample values may be determined by a blend ofmore than one of the primitives at the sample positions.

As described above, if just one tag buffer is used to store primitiveidentifiers for primitives within a tile then when hidden surfaceremoval is performed for a primitive which is not fully opaque then theprimitive identifiers that are already in the tag buffer will be flushedto allow the newly processed primitive identifier to be stored in thetag buffer. This results in a large number of separate flushingoperations, which may be less efficient than performing fewer, butlarger flushing operations which provides greater opportunity for opaqueprimitives to hide previously processed primitives, thereby avoidingunnecessary further processing being performed on the previouslyprocessed primitives which will ultimately be hidden in the final image.FIG. 6 shows a graphics processing system 600 which can reduce thenumber of separate flushing operations that are performed. The graphicsprocessing system 600 comprises a processing module 602, a depth buffer604, a tag sorter module 606, a texturing engine 608 and a pixel buffer610. In the example shown in FIG. 6, the tag sorter module 606 comprisesthree tag buffers 620 ₁ to 620 ₃ and a tag control module 622. Theelements of the graphics processing system 600 shown in FIG. 6 may beimplemented in hardware, software or a combination thereof.

The operation of the graphics processing system 600 is described withreference to the flow chart shown in FIG. 7. In step S702 the processingmodule 602 receives primitives which may relate to objects of a scene tobe rendered, and may for example be sent to the graphics processingsystem 600 from an application (e.g. a game) running on the same device(e.g. a mobile user device) as the graphics processing system 600. Inthis example the primitives relate to a single tile (e.g. tile 500) inwhich the primitives will be processed. Unlike the system of FIG. 3, thesystem of FIG. 6 does not support “multiple tiles in flight”. It istherefore not necessary for the processing module 602 to receive tilingdata indicating which one of several tiles the primitive should beprocessed in. Although the graphics processing system 600 is describedas having a rendering space which is subdivided into a plurality oftiles, it is noted that the use of multiple tag buffers to allow for thestorage of overlapping layers of primitive identifiers in the tag sortermodule 606 can be used in other examples which may not have a renderingspace which is divided into multiple tiles, i.e. which have only onetile.

In step S704 the processing module 602 performs hidden surface removal(HSR) for a primitive of the tile 500 by comparing depth values for thatprimitive with depth values stored in the depth buffer 604. The HSRperformed by the processing module 602 for a primitive may for examplecomprise determining which sample positions lie within the primitives(based on the vertex positions of the primitives), and performing depthtests at these sample positions based on the depth values stored in thedepth buffer 604. In this way, the HSR determines primitive identifiersidentifying the primitives which are visible at each of the samplepositions in the tile 500. As part of step S704 the processing module602 may update one or more of the depth values stored in the depthbuffer 604.

The three tag buffers 620 ₁ to 620 ₃ form a set of tag buffers which areconfigured to store primitive identifiers for each of the samplepositions in the tile, whereby primitive identifiers stored atcorresponding sample positions in the tag buffers 620 of the setrepresent overlapping layers of primitives.

In step S706 the tag control module 622 selects one of the tag buffers620 for the storage of each of the primitive identifiers output from theprocessing module 602 which identify primitives which are determined tobe visible by the hidden surface removal. In one example a tag buffer620 is selected independently for each sample position at which theprimitive is determined to be visible according to the primitiveidentifiers already stored in the tag buffers 620 at each sampleposition. In another example, processing module 602 performs hiddensurface removal for a primitive at each sample position in a microtile.A microtile is a group of sample positions, typically 4×4, for whichhidden surface removal for a primitive may be performed in parallel. Inthis case it may be appropriate to select one tag buffer to store allthe primitive identifiers for the fragments of a primitive determined tobe visible in the microtile. In a third example, one tag buffer isselected to store the primitive identifiers for all the fragments of aprimitive determined to be visible in the tile, whilst another tagbuffer may be selected to store the primitive identifiers for all thefragments of another primitive determined to be visible in the tile.Therefore, in the third example, the selection of a tag buffer forstoring the primitive identifiers of a primitive is performed at thescale of whole tiles, rather than at the scale of microtiles or at thescale of individual samples. In step S708 the primitive identifiers forthe fragments which are determined to be visible by the HSR for each ofthe sample positions are stored in the corresponding selected tagbuffer(s).

FIGS. 5 a and 5 b illustrate the example in which a tag buffer isselected independently for each sample position. With reference to FIG.5 a, one of the columns of sample positions is indicated by the arrow512. As an example, the primitive 502 is opaque, whereas the otherprimitives in the tile 500 (primitives 504, 506, 508 and 510) are alltranslucent. FIG. 5 b shows a column 514 ₁ of tag buffer 620 ₁, a column514 ₂ of tag buffer 620 ₂ and a column 514 ₃ of tag buffer 620 ₃. Eachof the columns 514 ₁ to 514 ₃ are configured to store primitiveidentifiers for the primitives shown in the column 512 shown in FIG. 5a. It can be appreciated that the primitives 502 to 510 overlap at someof the sample positions within the column 512. FIG. 5 b shows theviewpoint on the left of the figure, such that it can be seen that inthe example shown in FIG. 5 b, for each sample position, the column 514₁ of the tag buffer 620 ₁ is configured to store primitive identifiersfor primitives which are further away than overlapping primitives forwhich the column 514 ₂ of the tag buffer 620 ₂ is configured to storeprimitive identifiers, which themselves are further away thanoverlapping primitives for which the column 514 ₃ of the tag buffer 620₃ is configured to store primitive identifiers. In this way, the tagbuffers 620 represent overlapping layers of primitives at differentsample positions.

In an example, the primitive identifier for the primitive 502 isreceived at the tag sorter module 606 before the primitive identifiersfor the other primitives shown in FIG. 5 a. The primitive 502 is opaqueand covers all of the sample positions of tile 500. As such it will hideany primitives which may have previously been received for the tile 502which are further away, e.g. which have larger depth values, than theprimitive 502 (it is noted that in other examples the depth values maybe defined such that primitives which are further away have smallerdepth values). The primitive identifier for primitive 502 can thereforebe stored in the tag buffer 620 ₁ at all of the sample positions.Therefore the tag control module 622 selects the tag buffer 620 ₁, whichin this example is the one of the tag buffers 620 which stores primitiveidentifiers for the furthest layer of the primitives. This is shown inFIG. 5 b in that the primitive identifiers are stored for the primitive502 in the column 514 ₁ of the tag buffer 620 ₁. The tag sorter module606 may then receive primitive identifiers for the next primitive 504(which is translucent) and it will determine that the tag buffer 620 ₁is full at the sample positions covered by the primitive 504, and willtherefore select the next layer, i.e. buffer 620 ₂, to store theprimitive identifiers for the primitive 504. This is shown in FIG. 5 bin that primitive identifiers are stored for the primitive 504 in thecolumn 514 ₂ of the tag buffer 620 ₂.

The tag sorter module 606 may then receive primitive identifiers for thenext primitive 506 (which is translucent) and it will determine that thetag buffer 620 ₁ is full at the sample positions in the tile 500 coveredby the primitive 506, and will therefore select the next layer, i.e.buffer 620 ₂, to store the primitive identifiers for the primitive 506which are in the tile 500. It is noted that the primitive 506 does notoverlap the primitive 504 and as such the primitive identifiers for theprimitives 504 and 506 can be stored in the same tag buffer 620 ₂. Thisis shown in FIG. 5 b in that primitive identifiers are stored for theprimitive 506 in the column 514 ₂ of the tag buffer 620 ₂.

The tag sorter module 606 may then receive primitive identifiers for thenext primitive 508 (which is translucent) and it will determine that thetag buffer 620 ₁ is full at all of the sample positions covered by theprimitive 508. For some of the sample positions of the primitive 508 thetag buffer 620 ₂ is available but for some other sample positions of theprimitive 508 the tag buffer 620 ₂ is not available. In the exampleillustrated in FIG. 5 b, the primitive identifier 508 ₂ is stored incolumn 514 ₂ of buffer 620 ₂ at the locations where space is available.Primitive identifiers 508 ₁ and 508 ₃ are stored in column 514 ₃ of tagbuffer 620 ₃ at the locations where space in tag buffer 620 ₂ is notavailable. That is, the tag control module 622 selects the tag buffer620 for storing primitive identifiers on a per-sample position basis.

The tag sorter module 606 may then receive primitive identifiers for thenext primitive 510 (which is translucent) and it will determine that,for the column 512, none of the tag buffers 620 ₁, 620 ₂ and 620 ₃ areavailable at the sample positions covered by the primitive 510. This isrepresented in FIG. 5 b. Therefore, in order to store the primitiveidentifiers for the primitive 510 in a tag buffer, one of the tagbuffers is flushed. That is, in step S710, the primitive identifiersfrom one or more of the tag buffers 620 are flushed. The tag controlmodule 622 controls the flushing of the tag buffers 620. When primitiveidentifiers are flushed from a tag buffer 620 they are received at thetexturing engine 608. The flushing of a tag buffer 620 will make thattag buffer 620 available such that the primitive identifiers for theprimitive 510 can then be stored in the available tag buffer 620.

In another example the tag control module 622 selects a tag buffer 620for storing all primitive identifiers of a primitive that relate to aparticular microtile, such that for each of the microtiles, if all ofthe sample positions within that microtile are available in a layer thenthe primitive identifiers for the primitive are stored in the tag buffercorresponding to that layer. However, if it is not the case that all ofthe sample positions within a microtile are available in the layer thenthe primitive identifiers for the primitive are stored in the nextlayer. FIG. 5 c shows the same tile 500, column of sample positions 512,and opaque background primitive 502 as in FIG. 5 a. FIG. 5 d showscolumns 514 ₁, 514 ₂, and 514 ₃ of tag buffers 620 ₁, 620 ₂, and 620 ₃respectively, with column 514 ₁ containing primitive identifierscorresponding to primitive 502. Lines 530 and 532 divide the tile 500into four microtiles, each containing sixteen sample positions.Similarly, line 532 divides the columns 514 into upper and lower partscorresponding to the two microtiles intersected by the column of samplepositions 512.

In this example, the tag sorter module 606 may receive primitiveidentifiers for the primitive 520 (which is translucent). Tag buffer 620₁ already contains primitive identifiers for opaque primitive 502, sotag control module 622 selects tag buffer 620 ₂ to store the primitiveidentifiers for primitive 520. This is shown in FIG. 5 d in that theprimitive identifiers are stored for the primitive 520 in the column 514₂ of the tag buffer 620 ₂.

The tag sorter module 606 may then receive primitive identifiers for thenext primitive 522 (which is translucent). In this case a portion 522 ₁of the primitive identifiers for the primitive 522 are stored in thecolumn 514 ₂ of the tag buffer 620 ₂ because all of the sample positionswithin the relevant microtile are available in the tag buffer 620 ₂,whereas portion 522 ₂ of the primitive identifiers for the primitive 522are stored in the column 514 ₃ of the tag buffer 620 ₃ because it is notthe case that all of the sample positions within the relevant microtilesare available in the tag buffer 620 ₂. In general, for each microtile,the primitive identifiers of sample positions within the microtile arestored in the furthest layer represented by the tag buffers which isavailable for all of the sample positions within the microtile. That is,the selection in step S706 comprises selecting the one of the tagbuffers 620 that corresponds to the furthest available layer of theoverlapping layers for a block of one or more sample positions (i.e. fora microtile). In other examples, for each microtile, the primitiveidentifiers of sample positions within the microtile are stored in thefurthest layer represented by the tag buffers which is available for allof the sample positions covered by the primitive identifiers within themicrotile. That is, the selection in step S706 may comprise selectingthe one of the tag buffers 620 that corresponds to the furthestavailable layer of the overlapping layers for the primitive identifierswithin a block of one or more sample positions (i.e. for a microtile).

In step S712 the texturing engine 608 applies texturing and shading tothe primitives identified by the flushed primitive identifiers. Thetexturing is performed in the corresponding way to that described abovein relation to step S408. That is, the texturing engine 608 retrievestexture data and the identified primitives (e.g. from a memory) andapplies the texture data to the primitives identified by the flushedprimitive identifiers. As described above, the result of applying thetexturing to the primitives at the texturing unit 608 is a set of pixelvalues for the image. The pixel values are output from the texturingunit 608 and stored in the pixel buffer 610. The pixel buffer 610 storesthe pixel values of the image which can then be used in any suitablemanner, e.g. output to a display or stored in a memory or transmitted toanother device, etc.

In the examples described in detail above, the selection of a tag bufferfor the primitive identifiers is performed either for each individualsample position, or on the microtile scale, e.g. for a 4×4 block ofsample positions corresponding to a microtile. However, in otherexamples, the selection of a tag buffer may be performed at otherscales, e.g. for blocks of sample positions of different sizes and/orshapes. Choosing a larger scale may help to reduce occurrences offlushing primitives in multiple phases, which may occur when differentportions of the primitive identifiers are stored in different layers.However, choosing a larger scale reduces the opportunities to fill ingaps within layers of the tag buffers. Therefore, there is a trade-offto consider when setting the scale of the blocks.

When one of the tag buffers 620 is to be flushed, the tag control module622 determines which of the tag buffers to flush based on a flushingstrategy. For example, the flushing strategy may be that the tag buffer620 containing primitive identifiers of the furthest layer (e.g. tagbuffer 620 ₁ in the examples described above) is to be flushed beforeanother tag buffer 620 is flushed. As another example, the flushingstrategy may be that the tag buffer containing the most primitiveidentifiers (i.e. the fullest tag buffer) is to be flushed beforeanother tag buffer is flushed. The tag control module 622 may controlthe flushing of the primitive identifiers from the tag buffers 620 suchthat primitive identifiers from only one of the tag buffers 620 areflushed at a time. Alternatively, the tag control module 622 may controlthe flushing of the primitive identifiers from the tag buffers 620 suchthat primitive identifiers from multiple tag buffers 620 are flushedsimultaneously. Where the correct behaviour of the rendering depends onthe order in which primitives are rendered, the flushing strategy shouldbe chosen so as to preserve this. Note that when primitive identifiersare stored in multiple tag buffers, as shown in FIG. 5 b and FIG. 5 d,the layering reflects the order in which primitive identifiers arereceived by the tag sorter module 606, rather than the depths of theprimitives. Therefore the multiple tag buffers are capable of preservingorder.

FIG. 6 shows an example of how the graphics processing system could bearranged, in which there are three tag buffers 620. In other examplesthere may be two or more than three tag buffers in the graphicsprocessing system which could be configured to store primitiveidentifiers for different layers of primitives within a tile.

An advantage of using multiple tag buffers 620 to represent overlappinglayers of primitives is that sometimes primitive identifiers that arewritten to a tag buffer may identify primitives which are subsequentlyfound to be hidden by other primitives by the HSR performed by theprocessing module 602. In that case, the use of multiple tag buffers canreduce the number of primitive identifiers which are flushed to thetexturing engine 608. For example, if only one tag buffer was used inthe example shown in FIG. 5 a then the primitive identifiers for theprimitive 502 would have been flushed to the texturing engine inresponse to the arrival of the primitive identifiers for the translucentprimitive 504. If the next primitive to be processed was opaque and infront of the primitives 502 and 504 then primitives 502 and 504 may bewholly or partially hidden and as such the hidden parts of primitives502 and 504 would not need to be textured. With the use of multiple tagbuffers 620, the primitive identifiers for the primitive 502 would notbe flushed to the texturing engine 608 in response to the arrival of theprimitive identifiers for the primitive 504 at the tag sorter module606, because the primitive identifiers for the primitive 504 can bewritten into the second tag buffer 620 ₂. Therefore, no flushes haveoccurred when the primitive identifiers for the opaque primitivecovering primitives 502 and 504 is received at the tag sorter module606. In that case primitive identifiers for the primitives 502 and 504can be overwritten in the tag buffers 620 ₁ and 620 ₂ respectively wherethey are not needed to be textured. In this way, the unnecessarytexturing of fragments of primitives which are ultimately hidden byother primitives can be reduced.

The two ideas described above of allowing multiple tiles to be in flightat a given time with the use of multiple depth buffers, and allowingoverlapping layers of primitive identifiers to be stored in multiple tagbuffers can be combined to provide a very flexible graphics processingsystem.

FIG. 8 shows a graphics processing system 800 which combines features ofthe graphics processing systems 300 and 600 described above and shown inFIGS. 3 and 6 respectively. In particular, the graphics processingsystem 800 includes some of the same elements as the graphics processingsystem 300 and these elements are shown in FIG. 8 with the samereference numerals. That is, the graphics processing system 800 includesa block of queues 312 comprising four queues 314 ₁ to 314 ₄; aprocessing module 302; a block 304 of depth buffers 318 ₁ to 318 ₄; atexturing unit 308 comprising four texturing engines 324 ₁ to 324 ₄ anda pixel buffer 310. These elements operate as described above inrelation to graphics processing system 300. All of the elements of thegraphics processing system 800 shown in FIG. 8 may be implemented inhardware, software or a combination thereof.

As described in more detail below, the graphics processing system 800includes a control module 816, which is similar, but not identical tothe control module 316 of the graphics processing system 300.Furthermore, the graphics processing system 800 comprises a tag sortermodule 806 which is not the same as the tag sorter module 306 ofgraphics processing system 300. The tag sorter module 806 comprises atag control module 822 and eight tag buffers 820 ₁ to 820 ₈. In thisway, there are more tag buffers 820 than depth buffers 318, so more thanone tag buffer 820 can be used to store overlapping layers of primitiveidentifiers for primitives of a particular tile, as described above inrelation to one tile with reference to graphics processing system 600.It can therefore be seen that there is a group of eight tag buffers 820,and the graphics processing system 800 (in particular the tag controlmodule 822) is configured to dynamically associate, with each of thedepth buffers 318, a respective set of one or more of the eight tagbuffers 820. The association of the tag buffers with the depth buffers(which corresponds to an association of the tag buffers with the tilesthat are being processed) is performed dynamically in the sense that itcan be altered to suit the current requirements of the graphicsprocessing system 800.

For example, if none of the tag buffers 820 of a set which is currentlyassociated with a particular tile are available at a sample positionwhen a primitive identifier of a primitive covering that sample positionis received at the tag sorter module 806, then the tag control module822 can add an available tag buffer 820 to the set of tag buffers thatis associated with that tile. The additional tag buffer 820 in the setrepresents a new layer of primitives for the tile, and the primitiveidentifier can be stored in the additional tag buffer representing thenew layer.

If (in the same way as in the example given above) a primitiveidentifier is to be stored at a sample position to a tag buffer of theset of tag buffers associated with a particular tile, but none of thetag buffers of the set are available at the sample position, and if(unlike in the example given above) there are no available tag buffersin the group of tag buffers (820 ₁ to 820 ₈), then the tag controlmodule 822 may flush the primitive identifiers from one of the tagbuffers 820 ₁ to 820 ₈ thereby making that tag buffer available suchthat the primitive identifier can be stored in the available tag buffer.The tag buffer selected for flushing may or may not be a tag buffer thatis currently a member of the set of tag buffers associated with thetile. By flushing a tag buffer associated with one tile, and thenre-associating the flushed tag buffer with a different tile, the tagbuffer is moved to a different set.

There may be a predetermined maximum number of tag buffers 820 which canbe included in one of the sets of tag buffers 820 associated with atile. For example, the tag control module 822 might not associate morethan four of the tag buffers 820 to any given tile.

The distribution of objects within a scene is likely to be such thatsome tiles contain translucent objects, and some do not. Of those tilesthat contain translucent objects, the complexity of the scene, i.e. thenumber of layers of translucency, may vary considerably. The flexibilityin the association between tag buffers 820 and tiles allows the tagbuffers 820 to be used to best suit the current needs of the graphicsprocessing system 800.

As in the graphics processing system 300 described above, the flushedprimitive identifiers are passed to the texturing unit 308. One of thetexturing engines 324 ₁ to 324 ₄ applies texturing and shading to theprimitives identified by the flushed primitive identifiers. As describedabove, a texturing engine 324 retrieves texture data and the identifiedprimitives (e.g. from a memory) and applies the texture data to theprimitives identified by the flushed primitive identifiers. In theexample shown in FIG. 8 there are four texturing engines 324 ₁ to 324 ₄,i.e. there are the same number of texturing engines 324 as there aredepth buffers 318, and in this case each of the texturing engines isassociated with a respective tile such that all of the texturing that isapplied to the primitives of a particular tile is performed by the sametexturing engine 308. As described above, this may improve theefficiency of texturing the primitives in the case that there aremultiple tiles in flight. As described above, the texturing unit 308outputs a set of pixel values for the image which are then stored in thepixel buffer 310. In other examples, the number of texturing engines 324may be different to the number of depth buffers 318 and in that caseeach of the texturing engines might not be associated with a respectivetile.

As mentioned above the control module 816 is similar to the controlmodule 316 of the graphics processing system 300. However, the controlmodule 816 can further control which primitives are processed by theprocessing module 302 to thereby control the switching of the processingmodule 302 between processing primitives for different tiles, based onthe number of tag buffers 820 in the sets of tag buffers 820 which areassociated with the different tiles. For example, if there are lots oftag buffers 820 associated with a particular tile, the control module816 may control the block of queues 312 to prioritise the output ofprimitives for that tile. Having lots of tag buffers 820 associated witha tile may allow the graphics processing system 800 to process theprimitives for that tile more efficiently and as such the control module816 may control the processing module 302 to preferentially processprimitives from that tile.

FIGS. 9 a and 9 b show a flow chart for a method by which a tag controlmodule 822 may control the selection of tag buffers for storing incomingprimitive identifiers of a tile and the flushing of tag buffers in anexample.

Initially, no tag buffers are associated with the tile. At step 904 aset of primitive IDs are received. These primitive IDs correspond to asingle primitive, and to sample positions within the tile according tothe positions at which the primitive has been determined to be visible.The primitive may be opaque or translucent. At step 906 a decision ismade according to whether the primitive is opaque or translucent, and ifthe primitive is not translucent (i.e. if it is opaque), then at step908 a clearing process occurs. Step 908 will be described further below.In the initial case, where no tag buffers are allocated, step 908 has noeffect. At step 910 the tag control module 822 searches for a tag bufferin which to store the primitive IDs. The process within block 910 isdescribed in more detail below, and in FIG. 9 b. At step 912, the resultof the search process 910 is tested. If the search was successful and atag buffer was found, the flow advances to step 914, and the primitiveIDs are stored in the tag buffer that was found. However, in the initialcase there are no tag buffers in the set associated with the tile, andso search 910 will fail to find a suitable tag buffer. In this case theflow advances to a series of steps that will attempt to add a new tagbuffer to the set associated with the tile. Step 918 tests whether theset of tag buffers is already of a predetermined maximum size, and step920 checks to see whether there is an available buffer that is notcurrently associated with a tile. In the initial case, flow will proceedto step 922 in which a free tag buffer will be added to the setassociated with the tile. The primitive IDs may then be stored in thetag buffer, in step 914. At step 916 a test is made to determine whetherthere are more primitives to be processed. Flow proceeds accordingly,either to step 904, in order to receive further primitive IDs, or tostep 926 in which all the buffers are flushed (in order, from rear tofront), and the process ends.

The sub-process of step 910 is shown in FIG. 9 b. Note that forsimplicity of explanation, FIGS. 9 a and 9 b illustrate a system inwhich selection of a tag buffer for storing the primitive identifiers ofa primitive is performed at the scale of whole tiles, rather than at thescale of microtiles or at the scale of individual samples. Examples inwhich a tag buffer is selected per-pixel, or per-microtile, may beimplemented using straightforward modifications to the techniquedescribed here as will be apparent to a person skilled in the art. Theprocess begins at 952, and at 954 a test is made to determine whetherthe set of tag buffers allocated to the tile is empty. If the set isempty then at 964 the sub-process ends and reports that a buffer was notfound. When the set contains at least one buffer, the processing differsdepending on whether the primitive is opaque or translucent. This istested at 956, and in the simple case of an opaque primitive, thesub-process ends at 966 and reports that the rear buffer, i.e. the tagbuffer representing the layer furthest from the viewer is available tostore primitive IDs. The remaining steps are used when step 956identifies that the primitive is translucent. In this case the aim ofthe sub-process is to search the tag buffers in front to rear order andto report the rear-most layer in which it is possible to store theprimitive IDs. At 958, variables P and C represent the previous andcurrent tag buffers respectively. C is initialised to indicate thefront-most buffer. P will indicate the buffer one layer closer to thefront than C, however, since there is no closer buffer, P is initialisedwith a value indicating no buffer. At 960 a test is made to determinewhether all of the primitive IDs can be stored in the buffer indicatedby C. The process ends when it is found that the primitive IDs cannot bestored in C, as at this point it is known that the buffer indicated by Pmust be the rear-most layer in which it is possible to store theprimitive IDs. Step 962 returns the identity of buffer P. In the eventthat the test fails for the front most layer, the value of P willindicate directly that no buffer was found, due to the way that P wasinitialised in step 958. If the process does not end, i.e. the primitiveIDs can be stored in buffer C, the process continues to step 968 whichdetermines whether there is another buffer representing a layer deeperthan the current buffer C. If not, then C is the rear-most buffer, andthe primitive IDs may be stored in it, so at 970 the identity of bufferC is returned. If another buffer does exist then step 972 adjusts P andC by one step backwards, such that P stores the identity of what was thecurrent buffer, and C stores the identity of the buffer immediatelybehind the current buffer. Flow returns to the test of step 960, wherethe test is performed to see if the primitive IDs can be stored in thebuffer now represented by C.

Returning to FIG. 9 a, the result of sub-process 910 is tested at 912 todetermine whether a suitable buffer was found. If a buffer was foundthen the primitive IDs are stored in it, in step 914. When a buffer isnot found, steps 918-922 are used to allocate a new tag buffer to theset, and step 914 then stores the primitive IDs in the new buffer.Generally, the new buffer is allocated from a pool of free buffers.However, it is may not be desirable for the set of buffers associatedwith one tile to grow without limit, particularly if the pool of buffersis shared with several other tiles, e.g. as shown in FIG. 8. The test instep 918 may be used to limit the number of buffers in a set, and, bydirecting flow to step 924, to cause the rear-most buffer to be flushed(i.e. the contents of the buffer are sent to texturing and shading unit308). The flushed buffer may then be recycled and added to the set as anew front buffer in step 922. In another situation, the pool of freebuffers may be empty, e.g. the buffers have been allocated to setsassociated with other tiles. This is detected by the test in step 920.Again, flow is directed to step 924, when a buffer is flushed to createa new free buffer. In the case that the flow reached step 924 from step920, rather than from step 918, it is possible for the buffer selectedfor flushing to be a member of a set other than the one associated withthe current tile. That is, provided that it is permissible to extend aset, the set may be extended by flushing and transferring a buffer fromanother set. In this way, under the control of the control module 816and/or the tag sorter control module 822, the tag buffers may beallocated flexibly according to the requirements of the system.

When an opaque primitive is identified at step 906, step 908 performs aclearing operation. The tag sorter receives only primitive IDs forfragments that have passed a depth test. It is therefore known thatopaque primitive IDs must be in front of, and therefore will occlude,any other opaque or translucent primitives that have already beenprocessed. The primitive IDs for opaque objects may therefore always bestored in the rear-most tag buffer. Steps 956 and 966 of sub-process 910will identify opaque objects and return the identity of the rear-mostbuffer. Step 908 clears the stored primitive IDs for any translucentobjects already stored in any buffer layer, at the positionscorresponding to the opaque primitive IDs. This has the effect offlattening the layer structure, ensuring that translucent fragments arenot rendered unnecessarily or incorrectly. Optionally, step 308 maydetermine that the clearing process has left a tag buffer completelyempty, and return the empty layer to the pool of free buffers.

As described above, punch-through primitives are rendered in two passes.On the first pass, before the transparency has been evaluated, primitiveIDs for punch-through primitives may be handled as for translucentprimitives. On the second pass, a punch-through primitive ID correspondsto a part of the object that is known to be opaque. Therefore, on thesecond pass, primitive IDs for punch-through primitives may be handledas for opaque primitives.

Examples are described above in detail which relate to receivingprimitive identifiers of translucent primitives at the tag sortermodule. The same principles can be used when primitive identifiers forprimitives which have textures including punch through are received.

The methods described herein could be implemented by running suitablecomputer readable code which is adapted to perform the steps of themethods. Furthermore, the graphics process systems described hereincould be generated by running suitable computer readable code. Thecomputer readable code could be encoded on a computer readable storagemedium.

Generally, any of the functions, methods, techniques or componentsdescribed above can be implemented in modules using software, firmware,hardware (e.g., fixed logic circuitry), or any combination of theseimplementations. The terms “module,” “functionality,” “component”,“block”, “unit” and “logic” are used herein to generally representsoftware, firmware, hardware, or any combination thereof.

In the case of a software implementation, the module, functionality,component, block, unit or logic represents program code that performsspecified tasks when executed on a processor (e.g. one or more CPUs). Inone example, the methods described may be performed by a computerconfigured with software in machine readable form stored on acomputer-readable medium. One such configuration of a computer-readablemedium is signal bearing medium and thus is configured to transmit theinstructions (e.g. as a carrier wave) to the computing device, such asvia a network. The computer-readable medium may also be configured as acomputer-readable storage medium and thus is not a signal bearingmedium. Examples of a computer-readable storage medium include arandom-access memory (RAM), read-only memory (ROM), an optical disc,flash memory, hard disk memory, and other memory devices that may usemagnetic, optical, and other techniques to store instructions or otherdata and that can be accessed by a machine.

The software may be in the form of a computer program comprisingcomputer program code for configuring a computer to perform theconstituent portions of described methods or in the form of a computerprogram comprising computer program code means adapted to perform allthe steps of any of the methods described herein when the program is runon a computer and where the computer program may be embodied on acomputer readable medium. The program code can be stored in one or morecomputer readable media. The features of the techniques described hereinare platform-independent, meaning that the techniques may be implementedon a variety of computing platforms having a variety of processors.

Those skilled in the art will also realize that all, or a portion of thefunctionality, techniques or methods may be carried out by a dedicatedcircuit, an application-specific integrated circuit, a programmablelogic array, a field-programmable gate array, or the like. For example,the module, functionality, component or logic may comprise hardware inthe form of circuitry. Such circuitry may include transistors and/orother hardware elements available in a manufacturing process. Suchtransistors and/or other elements may be used to form circuitry orstructures that implement and/or contain memory, such as registers, flipflops, or latches, logical operators, such as Boolean operations,mathematical operators, such as adders, multipliers, or shifters, andinterconnects, by way of example. Such elements may be provided ascustom circuits or standard cell libraries, macros, or at other levelsof abstraction. Such elements may be interconnected in a specificarrangement. The module, functionality, component or logic may includecircuitry that is fixed function and circuitry that can be programmed toperform a function or functions; such programming may be provided from afirmware or software update or control mechanism. In an example,hardware logic has circuitry that implements a fixed function operation,state machine or process.

It is also intended to encompass software which “describes” or definesthe configuration of hardware that implements a module, functionality,component or logic described above, such as HDL (hardware descriptionlanguage) software, as is used for designing integrated circuits, or forconfiguring programmable chips, to carry out desired functions. That is,there may be provided a computer readable storage medium having encodedthereon computer readable program code for generating a processing unitconfigured to perform any of the methods described herein, or forgenerating a processing unit comprising any apparatus described herein.

The term ‘processor’ and ‘computer’ are used herein to refer to anydevice, or portion thereof, with processing capability such that it canexecute instructions, or a dedicated circuit capable of carrying out allor a portion of the functionality or methods, or any combinationthereof.

Although the subject matter has been described in language specific tostructural features and/or methodological acts, it is to be understoodthat the subject matter defined in the appended claims is notnecessarily limited to the specific features or acts described above.Rather, the specific features and acts described above are disclosed asexample forms of implementing the claims. It will be understood that thebenefits and advantages described above may relate to one example or mayrelate to several examples.

Any range or value given herein may be extended or altered withoutlosing the effect sought, as will be apparent to the skilled person. Forexample, the specific numbers given in the examples described above(e.g. the numbers of tag buffers, depth buffers, queues, texturingengines, tiles, microtiles within a tile and sample positions within amicrotile) are given by way of example only. The steps of the methodsdescribed herein may be carried out in any suitable order, orsimultaneously where appropriate. Aspects of any of the examplesdescribed above may be combined with aspects of any of the otherexamples described to form further examples without losing the effectsought.

1. A graphics processing system comprising: a plurality of depthbuffers, each of the depth buffers being configured to be dynamicallyassociated with one tile at a time of a rendering space sub-divided intoa plurality of tiles, and configured to store a depth value for each ofa plurality of sample positions within the tile; and a processing moduleconfigured to receive primitives and tiling data, wherein for eachprimitive the tiling data indicates one or more tiles in which thatprimitive will be processed, and wherein the processing module isconfigured to perform hidden surface removal for a primitive of a tileby comparing depth values for that primitive with depth values stored inthe depth buffer associated with the tile while another one of the depthbuffers stores depth values for a different partially processed tile. 2.The graphics processing system of claim 1 wherein the processing moduleis configured to update one or more depth values stored in the depthbuffer associated with a tile as part of performing the hidden surfaceremoval for a primitive of the tile.
 3. The graphics processing systemof claim 1 further comprising a plurality of tag buffers configured tobe dynamically associated with the tiles such that a set of one or moreof the tag buffers is associated with a particular tile, said set of tagbuffers being configured to store primitive identifiers identifying theprimitives determined by the hidden surface removal to be visible ateach sample position within the particular tile.
 4. The graphicsprocessing system of claim 3 wherein if the set of tag buffersassociated with the particular tile includes more than one tag buffer,then primitive identifiers stored at corresponding sample positions inthe tag buffers of the set represent overlapping layers of primitives.5. The graphics processing system of claim 3 wherein the graphicsprocessing system comprises more tag buffers than depth buffers.
 6. Thegraphics processing system of claim 3 further comprising one or moretexturing engines configured to apply texturing to the primitives oftiles identified by primitive identifiers stored in the tag buffersassociated with the tiles.
 7. The graphics processing system of claim 6wherein the graphics processing system is configured to send primitiveidentifiers in the set of tag buffers associated with the particulartile to the same texturing engine, such that texturing that is appliedto the visible primitives of the particular tile is applied by the sametexturing engine.
 8. The graphics processing system of claim 6 whereinthe number of texturing engines is the same as the number of depthbuffers.
 9. The graphics processing system of claim 1 further comprisinga control module configured to control which primitives are processed bythe processing module to thereby control switching of the processingmodule between processing primitives for different tiles.
 10. Thegraphics processing system of claim 9 further comprising a plurality ofqueues storing primitives for a respective plurality of tiles, whereinthe control module is configured to select one of the queues, wherein aprimitive from the selected queue is processed by the processing module.11. The graphics processing system of claim 9 wherein the control moduleis configured to control which primitives are processed by theprocessing module based on state information relating to the state ofthe graphics processing system.
 12. The graphics processing system ofclaim 11 further comprising one or more texturing engines configured toapply texturing to the primitives of tiles identified by primitiveidentifiers stored in the tag buffers associated with the tiles, whereinthe state information comprises an indication that a texturing engine isidle or is about to become idle, and wherein the control module isconfigured to prioritise the processing of primitives for a tile if thetexturing engine which is configured to apply texturing to theprimitives of that tile is indicated as being idle or is indicated asbeing about to become idle.
 13. The graphics processing system of claim11 wherein the state information comprises an indication that theprocessing of a tile has stalled, and wherein the control module isconfigured to deprioritise the processing of primitives for a stalledtile.
 14. The graphics processing system of claim 11 wherein the stateinformation comprises an indication that there is a large quantity ofdata to process in a tile, and wherein the control module is configuredto prioritise the processing of primitives for said tile.
 15. A methodof processing primitives in a graphics processing system, comprising:storing depth values in a plurality of depth buffers, each of the depthbuffers being dynamically associated with one tile at a time of arendering space sub-divided into a plurality of tiles, and beingconfigured to store a depth value for each of a plurality of samplepositions within the tile; receiving primitives and tiling data at aprocessing module, wherein for each primitive the tiling data indicatesone or more tiles in which that primitive will be processed; andperforming hidden surface removal at the processing module for aprimitive of a tile by comparing depth values for that primitive withdepth values stored in the depth buffer associated with the tile whileanother one of the depth buffers stores depth values for a differentpartially processed tile.
 16. The method of claim 15 further comprisingupdating one or more depth values stored in the depth buffer associatedwith a tile as part said performing hidden surface removal for aprimitive of the tile.
 17. The method of claim 15 further comprising:dynamically associating a plurality of tag buffers with the tiles suchthat a set of one or more of the tag buffers is associated with aparticular tile; and storing, in said set of tag buffers, primitiveidentifiers identifying the primitives determined by the hidden surfaceremoval to be visible at each sample position within the particulartile.
 18. The method of claim 17 further comprising applying texturingto the primitives of tiles identified by primitive identifiers stored inthe tag buffers associated with the tiles, wherein the texturing isapplied by one or more texturing engines, and wherein the methodcomprises sending primitive identifiers in the set of tag buffersassociated with the particular tile to the same texturing engine, suchthat texturing that is applied to the visible primitives of theparticular tile is applied by the same texturing engine.
 19. The methodof claim 15 further comprising controlling which primitives areprocessed by the processing module to thereby control switching of theprocessing module between processing primitives for different tiles. 20.A non-transitory computer readable storage medium having encoded thereonprocessor executable instruction that when executed cause at least oneprocessor to: store depth values in a plurality of depth buffers, eachof the depth buffers being dynamically associated with one tile at atime of a graphics rendering space sub-divided into a plurality oftiles, and being configured to store a depth value for each of aplurality of sample positions within the tile; receive primitives andtiling data at a processing module, wherein for each primitive thetiling data indicates one or more tiles in which that primitive will beprocessed; and perform hidden surface removal at the processing modulefor a primitive of a tile by comparing depth values for that primitivewith depth values stored in the depth buffer associated with the tilewhile another one of the depth buffers stores depth values for adifferent partially processed tile.
 21. A non-transitory computerreadable storage medium having encoded thereon processor executableinstruction that when executed cause at least one processor to generatea graphics processing system comprising: a plurality of depth buffers,each of the depth buffers being configured to be dynamically associatedwith one tile at a time of a rendering space sub-divided into aplurality of tiles, and configured to store a depth value for each of aplurality of sample positions within the tile; and a processing moduleconfigured to receive primitives and tiling data, wherein for eachprimitive the tiling data indicates one or more tiles in which thatprimitive will be processed, and wherein the processing module isconfigured to perform hidden surface removal for a primitive of a tileby comparing depth values for that primitive with depth values stored inthe depth buffer associated with the tile while another one of the depthbuffers stores depth values for a different partially processed tile.